import { baseRequest } from '@/common/axios'
import { objToParams } from '@/utils/util.js'
import appConfig from '@/static/app.config.js'

export default {
	// 【预警通报-决策预警信号点击弹窗
	GetProcessList(data) {
		return baseRequest('/api/Meteo/AlarmSingal/GetProcessList', data, 'get')
	},
	//获取预警信号数据
	GetAlarmSignal(data) {
		return baseRequest('/api/Meteo/AlarmSingal/Page', data, 'post')
	},
	//获取预警信号弹窗防御措施
	GetAlarmSignalDefense(data) {
		return baseRequest('/api/Meteo/AlarmSingal/GetDefenseGuide', data, 'get')
	},

	//山洪预览
	getShText(data) {
		// 文件流
		// return baseRequest( '/api/wpd-sanming/sift/getFlashFloodDisasterRiskText', data, 'get', {
		// 	responseType: 'blob'
		// })
		// 路径
		return '/api/wpd-sanming/sift/getFlashFloodDisasterRiskText' + objToParams(data)
	},
	//地灾列表
	getDzList(params, data) {
		return baseRequest('/api/wpd-sanming/sift/disposeProductCode' + objToParams(params), data, 'post')
	},
	//地灾预览
	getDzText(data) {
		return baseRequest('/api/wpd-sanming/sift/getFile', data, 'post')
	},
	//地灾打点
	async getDzSite(data) {
		let dzdGeoJson = uni.getStorageSync('dzdGeoJson')
		if (dzdGeoJson) {
			return dzdGeoJson
		} else {
			dzdGeoJson = await baseRequest('/geoserver/sanming/wms', data, 'get', false)
			if (dzdGeoJson && dzdGeoJson.timeStamp) {
				uni.setStorageSync('dzdGeoJson', dzdGeoJson)
			}
			return dzdGeoJson
		}
	},
	//河道预警json
	getHdJson(data) {
		return baseRequest('/api/sanming/预警河段.json', data, 'get')
	},
	// 山洪预警
	getSift(data) {
		return baseRequest('/api/wpd-sanming/sift/siftObj', data, 'post')
	},
	//河道预警列表 废弃
	getCovtLink(data) {
		return baseRequest('/api/wpd-sanming/sift/covtLink', data, 'post')
	}
}
